"""
求一个3*3二维数组中每行的最大值和每行的和
"""
list1 = list(map(int, input().split()))
count = 0
print("{:4d}{:4d}{:4d}{:4d}{:4d}".format(list1[0], list1[1], list1[2], max(list1[:3]), sum(list1[:3])))
print("{:4d}{:4d}{:4d}{:4d}{:4d}".format(list1[3], list1[4], list1[5], max(list1[3:6]), sum(list1[3:6])))
print("{:4d}{:4d}{:4d}{:4d}{:4d}".format(list1[6], list1[7], list1[8], max(list1[6:9]), sum(list1[6:9])))
